from pywinauto.application import Application
from time import sleep

notepad = Application().start('notepad')
notepad['记事本']['Edit'].type_keys('Hello world!', with_spaces=True)
notepad['记事本'].menu_select('编辑(&E) -> 替换(&R)')
notepad['替换']['Edit1'].type_keys('^a{DELETE}H')
notepad['替换']['Edit2'].type_keys('^a{DELETE}h')
notepad['替换']['全部替换'].click()
notepad['替换']['取消'].close_click()
notepad['记事本'].menu_select('文件(&F) -> 退出(&X)')
notepad['记事本']['不保存'].close_click()
notepad.kill()
